﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Simple.Repository.Models.Article
{
    /// <summary>
    /// 文章管理表
    /// </summary>
    public class ArticleManageImage : BusinessFullEntityBase<Guid>
    {

        /// <summary>
        /// 文件Id
        /// </summary>
        public Guid? FiledId { get; set; }

        /// <summary>
        /// 文件名称
        /// </summary>
        public string FileName { get; set; } = "";

        /// <summary>
        /// 文件大小
        /// </summary>
        public string FileSize { get; set; } = "";

        /// <summary>
        /// 文章管理
        /// </summary>
        public ArticleManage ArticleManage = new ArticleManage();

        /// <summary>
        /// 文章Id
        /// </summary>
        public Guid? ArticleId { get; set; } = null;

        public override void ConfigureEntity(ModelBuilder builder)
        {
            builder.Entity<ArticleManageImage>(entity =>
            {
                entity.ToTable("Article_Image");
                entity.HasOne(c => c.ArticleManage).WithMany(c => c.Images).HasForeignKey(c => c.ArticleId);
            });
        }

    }
}
